var phpVars;if(!phpVars){phpVars={ADMIN_THEME_ID:".default",LANGUAGE_ID:"en",FORMAT_DATE:"DD.MM.YYYY",FORMAT_DATETIME:"DD.MM.YYYY HH:MI:SS",opt_context_ctrl:false,cookiePrefix:"BITRIX_SM",titlePrefix:"",bitrix_sessid:"",messHideMenu:"",messShowMenu:"",messHideButtons:"",messShowButtons:"",messFilterInactive:"",messFilterActive:"",messFilterLess:"",messLoading:"Loading...",messMenuLoading:"",messMenuLoadingTitle:"",messNoData:"",messExpandTabs:"",messCollapseTabs:"",messPanelFixOn:"",messPanelFixOff:"",messPanelCollapse:"",messPanelExpand:"",messFavAddSucc:"",messFavAddErr:"",messFavDelSucc:"",messFavDelErr:""}}function JCSplitter(e){this.params=e;this.Highlight=function(e){var t=document.getElementById(this.params.control);var s=document.getElementById(this.params.divShown);if(s.style.display!="none")t.className=this.params.classShown+(e?"sel":"");else t.className=this.params.classHidden+(e?"sel":"")};this.Toggle=function(){var e=jsUtils.ToggleDiv(this.params.divShown);jsUtils.ToggleDiv(this.params.divHidden);this.Highlight(false);document.getElementById(this.params.control).title=e?this.params.messHide:this.params.messShow;return e}}function JCAdminMenu(e){var t=this;this.sMenuSelected="";this.x=0;this.divToResize=null;this.divToBound=null;this.toggle=false;this.oSections={};this.request=new JCHttpRequest;var s=e.split(",");for(var i in s)this.oSections[s[i]]=true;this.verSplitter=new JCSplitter({control:"vdividercell",divShown:"menudiv",divHidden:"hiddenmenucontainer",messHide:phpVars.messHideMenu,messShow:phpVars.messShowMenu,classShown:"vdividerknob vdividerknobleft",classHidden:"vdividerknob vdividerknobright"});this.horSplitter=new JCSplitter({control:"hdividercell",divShown:"buttonscontainer",divHidden:"smbuttonscontainer",messHide:phpVars.messHideButtons,messShow:phpVars.messShowButtons,classShown:"hdividerknob hdividerknobup",classHidden:"hdividerknob hdividerknobdown"});this.verSplitterToggle=function(){var e=this.verSplitter.Toggle();jsUserOptions.SaveOption("admin_menu","pos","ver",e?"on":"off")};this.horSplitterToggle=function(){var e=this.horSplitter.Toggle();jsUserOptions.SaveOption("admin_menu","pos","hor",e?"on":"off")};this.ToggleMenu=function(e,t){var s=document.getElementById(e);if(s.style.display!="none")return;if(this.sMenuSelected!="")document.getElementById(this.sMenuSelected).style.display="none";s.style.display="block";document.getElementById("menutitle").innerHTML=t;document.getElementById("btn_"+this.sMenuSelected).className="button";document.getElementById("smbtn_"+this.sMenuSelected).className="smbutton";document.getElementById("btn_"+e).className="button buttonsel";document.getElementById("smbtn_"+e).className="smbutton smbuttonsel";this.sMenuSelected=e};this.StartDrag=function(){if(this.toggle)return;if(document.getElementById("menudiv").style.display=="none")return;this.divToBound=document.getElementById("menu_min_width");this.divToResize=document.getElementById("menucontainer");this.x=this.divToResize.offsetWidth;jsUtils.addEvent(document,"mousemove",t.ResizeMenu);document.onmouseup=this.StopDrag;var e=document.body;e.ondrag=jsUtils.False;e.onselectstart=jsUtils.False;e.style.MozUserSelect="none";e.style.cursor="e-resize"};this.StopDrag=function(e){jsUtils.removeEvent(document,"mousemove",t.ResizeMenu);document.onmouseup=null;var s=document.body;s.ondrag=null;s.onselectstart=null;s.style.MozUserSelect="";s.style.cursor="";if(window.onresize)window.onresize();jsUserOptions.SaveOption("admin_menu","pos","width",parseInt(t.divToResize.style.width))};this.ResizeMenu=function(e){var s=e.clientX+document.body.scrollLeft;if(t.x==s)return;var i=t.divToResize;var n=t.divToBound;if(s<n.offsetWidth){i.style.width=n.offsetWidth+"px";t.x=s;return}i.style.width=i.offsetWidth+(s-t.x)+"px";t.x=s};this.ToggleSection=function(e,t,s){if(jsUtils.ToggleDiv(t)){if(s<=2)this.oSections[t]=true;e.className="sign signminus"}else{this.oSections[t]=false;e.className="sign signplus"}if(s<=2){var i="";for(var n in this.oSections)if(this.oSections[n]==true)i+=(i!=""?",":"")+n;jsUserOptions.SaveOption("admin_menu","pos","sections",i)}};this.ToggleDynSection=function(e,t,s,i){function n(e){var t="";for(var s=0;s<i;s++)t+='<td><div class="menuindent"></div></td>\n';return'<div class="menuline">'+'<table cellspacing="0">'+"\t<tr>"+t+'\t\t<td class="menutext menutext-loading">'+e+"</td>"+"\t</tr>"+"</table>"+"</div>"}var a=document.getElementById(s);if(a.innerHTML==""){a.innerHTML=n(phpVars.messMenuLoading);this.request.Action=function(e){e=jsUtils.trim(e);a.innerHTML=e!=""?e:n(phpVars.messNoData)};this.request.Send("/bitrix/admin/get_menu.php?lang="+phpVars.LANGUAGE_ID+"&admin_mnu_module_id="+t+"&admin_mnu_menu_id="+encodeURIComponent(s))}this.ToggleSection(e,s,i)}}function JCAdminList(e){var t=this;this.table_id=e;this.InitTable=function(){var e=document.getElementById(this.table_id);if(!e||e.rows.length<1||e.rows[0].cells.length<1)return;var s;var i=e.rows[0].cells.length;var n=-1;for(s=0;s<i;s++){var a;var l=e.rows[1].cells[s];var o=jsUtils.FindChildObject(l,"table","sorting");for(a=0;a<2;a++){var r=e.rows[a].cells[s];r.onmouseover=function(){t.HighlightGutter(this,true)};r.onmouseout=function(){t.HighlightGutter(this,false)};if(o){r.onclick=o.onclick;r.title=o.title;r.style.cursor="pointer";if(a==0){var d=o.rows[0].cells[1].className.toLowerCase();if(d=="sign up"||d=="sign down"){r.className+=" sorted";n=s}}}}if(o)o.onclick=null}var c=e.rows.length;for(s=0;s<c;s++){var u=e.rows[s];u.cells[0].className+=" left";u.cells[u.cells.length-1].className+=" right";if(u.className&&u.className=="footer")continue;if(n!=-1&&n<u.cells.length)u.cells[n].className+=" sorted";if(s>=2){var m=u.cells[0].childNodes[0];if(m&&m.tagName&&m.tagName.toUpperCase()=="INPUT"&&m.type.toUpperCase()=="CHECKBOX"){m.onclick=function(){t.SelectRow(this);t.EnableActions()};jsUtils.addEvent(u,"click",t.OnClickRow)}u.onmouseover=function(){t.HighlightRow(this,true)};u.onmouseout=function(){t.HighlightRow(this,false)};if(s%2==0)u.className+=" odd";else u.className+=" even";if(u.oncontextmenu){jsUtils.addEvent(u,"contextmenu",function(e){if(!e)e=window.event;if(!phpVars.opt_context_ctrl&&e.ctrlKey||phpVars.opt_context_ctrl&&!e.ctrlKey)return;var s;if(e.target)s=e.target;else if(e.srcElement)s=e.srcElement;while(s&&!s.oncontextmenu)s=jsUtils.FindParentObject(s,"tr");var i=e.clientX+document.body.scrollLeft;var n=e.clientY+document.body.scrollTop;var a={};a["left"]=a["right"]=i;a["top"]=a["bottom"]=n;var l=window[t.table_id+"_menu"];l.PopupHide();l.SetItems(s.oncontextmenu());l.BuildItems();l.PopupShow(a);e.returnValue=false;if(e.preventDefault)e.preventDefault()})}}}if(e.rows.length>2){e.rows[2].className+=" top";e.rows[e.rows.length-1].className+=" bottom"}};this.Destroy=function(e){var s=document.getElementById(this.table_id);if(!s||s.rows.length<1||s.rows[0].cells.length<1)return;var i;var n=s.rows[0].cells.length;for(i=0;i<n;i++){var a;for(a=0;a<2;a++){var l=s.rows[a].cells[i];l.onmouseover=null;l.onmouseout=null;l.onclick=null}}var o=s.rows.length;for(i=0;i<o;i++){var r=s.rows[i];var d=r.cells[0].childNodes[0];if(d&&d.onclick)d.onclick=null;r.onmouseover=null;r.onmouseout=null;jsUtils.removeAllEvents(r)}if(e==true)t=null};this.HighlightGutter=function(e,t){var s=e.parentNode.parentNode.parentNode;var i=s.rows[0].cells[e.cellIndex];if(t)i.className+=" over";else i.className=i.className.replace(/\s*over/i,"")};this.HighlightRow=function(e,t){if(t)e.className+=" over";else e.className=e.className.replace(/\s*over/i,"")};this.SelectRow=function(e){var t=e.parentNode.parentNode;var s=t.parentNode.parentNode;var i=document.getElementById(s.id+"_selected_span");var n=parseInt(i.innerHTML);if(e.checked){t.className+=" selected";n++}else{t.className=t.className.replace(/\s*selected/gi,"");n--}i.innerHTML=n;var a=document.getElementById(s.id+"_check_all");if(n==s.rows.length-2)a.checked=true;else a.checked=false};this.OnClickRow=function(e){if(!e)var e=window.event;if(!e.ctrlKey)return;var s=e.target?e.target:e.srcElement?e.srcElement:null;if(!s)return;if(!s.parentNode.cells)return;var i=s.parentNode.cells[0].childNodes[0];if(i&&i.tagName&&i.tagName.toUpperCase()=="INPUT"&&i.type.toUpperCase()=="CHECKBOX"&&!i.disabled){i.checked=!i.checked;t.SelectRow(i)}t.EnableActions()};this.SelectAllRows=function(e){var t=e.parentNode.parentNode.parentNode.parentNode;var s=e.checked;var i;var n=t.rows.length;for(i=2;i<n;i++){var a=t.rows[i].cells[0].childNodes[0];if(a&&a.tagName&&a.tagName.toUpperCase()=="INPUT"&&a.type.toUpperCase()=="CHECKBOX"){if(a.checked!=s&&!a.disabled){a.checked=s;this.SelectRow(a)}}}this.EnableActions()};this.EnableActions=function(){var e=document.forms["form_"+this.table_id];if(!e)return;var t=this.IsActionEnabled();var s=this.IsActionEnabled("edit");if(e.apply)e.apply.disabled=!t;var i=document.getElementById("action_edit_button");if(i)i.className="context-button icon action-edit-button"+(s?"":"-dis");i=document.getElementById("action_delete_button");if(i)i.className="context-button icon action-delete-button"+(t?"":"-dis")};this.IsActionEnabled=function(e){var t=document.forms["form_"+this.table_id];if(!t)return;var s=false;var i=document.getElementById(this.table_id+"_selected_span");if(i&&parseInt(i.innerHTML)>0)s=true;if(e=="edit")return!(t.action_target&&t.action_target.checked)&&s;else return t.action_target&&t.action_target.checked||s};this.SetActiveResult=function(e,s){CHttpRequest.Action=function(i){CloseWaitWindow();t.Destroy(false);document.getElementById(t.table_id+"_result_div").innerHTML=i;t.InitTable();jsAdminChain.AddItems(t.table_id+"_navchain_div");if(e)e(s)}};this.GetAdminList=function(e,s){ShowWaitWindow();var i=new RegExp("&mode=list&table_id="+escape(t.table_id),"g");e=e.replace(i,"");var n=document.getElementById("navchain-link");if(n)n.href=e;if(e.indexOf("?")>=0)e+="&mode=list&table_id="+escape(t.table_id);else e+="?&mode=list&table_id="+escape(t.table_id);t.SetActiveResult(s,e);CHttpRequest.Send(e)};this.Sort=function(e,t,s){if(t==true){var i=null,n=false;if(s.length>0)i=s[0];if(!i)i=window.event;if(i)n=i.ctrlKey;e+=n?"desc":"asc"}this.GetAdminList(e)};this.PostAdminList=function(e){if(e.indexOf("?")>=0)e+="&mode=frame&table_id="+escape(this.table_id);else e+="?mode=frame&table_id="+escape(this.table_id);var t=document.getElementById("form_"+this.table_id);try{t.action.act.parentNode.removeChild(t.action)}catch(e){}t.action=e;t.onsubmit();t.submit()};this.ShowSettings=function(e){if(document.getElementById("settings_float_div"))return;CHttpRequest.Action=function(e){CloseWaitWindow();if(e=="")return;var s=document.body.appendChild(document.createElement("DIV"));s.id="settings_float_div";s.className="settings-float-form";s.style.position="absolute";s.innerHTML=e;var i=parseInt(document.body.scrollLeft+document.body.clientWidth/2-s.offsetWidth/2);var n=parseInt(document.body.scrollTop+document.body.clientHeight/2-s.offsetHeight/2);jsFloatDiv.Show(s,i,n);jsUtils.addEvent(document,"keypress",t.SettingsOnKeyPress)};ShowWaitWindow();CHttpRequest.Send(e)};this.CloseSettings=function(){jsUtils.removeEvent(document,"keypress",t.SettingsOnKeyPress);var e=document.getElementById("settings_float_div");jsFloatDiv.Close(e);e.parentNode.removeChild(e)};this.SettingsOnKeyPress=function(e){if(!e)e=window.event;if(!e)return;if(e.keyCode==27)t.CloseSettings()};this.SaveSettings=function(){ShowWaitWindow();var e="",s="",i="",n="";var a=document.list_settings.selected_columns;var l=a.length;for(var o=0;o<l;o++)e+=(e!=""?",":"")+a[o].value;a=document.list_settings.order_field;if(a)s=a[a.selectedIndex].value;a=document.list_settings.order_direction;if(a)i=a[a.selectedIndex].value;a=document.list_settings.nav_page_size;n=a[a.selectedIndex].value;var r=document.list_settings.set_default&&document.list_settings.set_default.checked;jsUserOptions.SaveOption("list",this.table_id,"columns",e,r);jsUserOptions.SaveOption("list",this.table_id,"by",s,r);jsUserOptions.SaveOption("list",this.table_id,"order",i,r);jsUserOptions.SaveOption("list",this.table_id,"page_size",n,r);var d=window.location.href;jsUserOptions.SendData(function(){t.GetAdminList(d,t.CloseSettings)})};this.DeleteSettings=function(e){ShowWaitWindow();var s=window.location.href;jsUserOptions.DeleteOption("list",this.table_id,e,function(){t.GetAdminList(s,t.CloseSettings)})}}function TabControl(name,unique_name,aTabs){var _this=this;this.name=name;this.unique_name=unique_name;this.aTabs=aTabs;this.aTabsDisabled={};this.bExpandTabs=false;this.AUTOSAVE=null;var auto_lnk=BX(this.name+"_autosave_link");if(auto_lnk){auto_lnk.title=BX.message("AUTOSAVE_T");BX.addCustomEvent("onAutoSavePrepare",function(e,t){BX.bind(auto_lnk,"click",BX.proxy(e.Save,e))});BX.addCustomEvent("onAutoSave",function(){auto_lnk.className="context-button bx-core-autosave bx-core-autosave-saving"});BX.addCustomEvent("onAutoSaveFinished",function(e,t){t=parseInt(t);if(!isNaN(t)){setTimeout(function(){auto_lnk.className="context-button bx-core-autosave bx-core-autosave-ready"},1e3);auto_lnk.title=BX.message("AUTOSAVE_L").replace("#DATE#",BX.formatDate(new Date(t*1e3)))}});BX.addCustomEvent("onAutoSaveInit",function(){auto_lnk.className="context-button bx-core-autosave bx-core-autosave-edited"})}this.NextTab=function(){var e=BX.findChild(document,{className:"tab-selected"},true);if(e)var t=e.id.substr(4);else{var e=BX.findChild(document,{className:"tab-container-selected"},true);var t=e.id.substr(9)}var s="";for(var i=0;i<this.aTabs.length;i++){if(t==this.aTabs[i]["DIV"]){if(i>=this.aTabs.length-1)s=this.aTabs[0];else s=this.aTabs[i+1]}}if(s["DIV"])this.SelectTab(s["DIV"])};this.SelectTab=function(tab_id){var div=document.getElementById(tab_id);if(div.style.display!="none")return;for(var i=0,cnt=this.aTabs.length;i<cnt;i++){var tab=document.getElementById(this.aTabs[i]["DIV"]);if(tab.style.display!="none"){this.ShowTab(this.aTabs[i]["DIV"],false);tab.style.display="none";break}}this.ShowTab(tab_id,true);div.style.display="block";document.getElementById(this.name+"_active_tab").value=tab_id;for(var i=0,cnt=this.aTabs.length;i<cnt;i++)if(this.aTabs[i]["DIV"]==tab_id){this.aTabs[i]["_ACTIVE"]=true;if(this.aTabs[i]["ONSELECT"])eval(this.aTabs[i]["ONSELECT"]);break}};this.ShowTab=function(e,t){var s=t?"-selected":"";try{document.getElementById("tab_cont_"+e).className="tab-container"+s;document.getElementById("tab_left_"+e).className="tab-left"+s;document.getElementById("tab_"+e).className="tab"+s;if(e!=this.aTabs[this.aTabs.length-1]["DIV"])document.getElementById("tab_right_"+e).className="tab-right"+s;else document.getElementById("tab_right_"+e).className="tab-right-last"+s}catch(e){}};this.HoverTab=function(e,t){var s=document.getElementById("tab_"+e);if(s.className=="tab-selected")return;document.getElementById("tab_left_"+e).className=t?"tab-left-hover":"tab-left";s.className=t?"tab-hover":"tab";var i=document.getElementById("tab_right_"+e);if(e!=this.aTabs[this.aTabs.length-1]["DIV"])i.className=t?"tab-right-hover":"tab-right";else i.className=t?"tab-right-last-hover":"tab-right-last"};this.InitEditTables=function(){for(var e=0,t=this.aTabs.length;e<t;e++){var s=document.getElementById(this.aTabs[e]["DIV"]);var i=jsUtils.FindChildObject(s.firstChild,"table","edit-table");if(!i){var i=jsUtils.FindChildObject(s,"table","edit-table");if(!i)continue}var n=i.rows.length;for(var a=0;a<n;a++)if(i.rows[a].cells.length>1)i.rows[a].cells[0].className="field-name"}};this.DisableTab=function(e){this.aTabsDisabled[e]=true;this.ShowDisabledTab(e,true);if(this.bExpandTabs){var t=document.getElementById(e);t.style.display="none"}};this.EnableTab=function(e){this.aTabsDisabled[e]=false;this.ShowDisabledTab(e,this.bExpandTabs);if(this.bExpandTabs){var t=document.getElementById(e);t.style.display="block"}};this.ShowDisabledTab=function(e,t){var s=document.getElementById("tab_cont_"+e);if(t){s.className="tab-container-disabled";s.onclick=null;s.onmouseover=null;s.onmouseout=null}else{s.className="tab-container";s.onclick=function(){_this.SelectTab(e)};s.onmouseover=function(){_this.HoverTab(e,true)};s.onmouseout=function(){_this.HoverTab(e,false)}}};this.Destroy=function(){for(var e=0,t=this.aTabs.length;e<t;e++){var s=document.getElementById("tab_cont_"+this.aTabs[e]["DIV"]);if(!s)continue;s.onclick=null;s.onmouseover=null;s.onmouseout=null}_this=null};this.ToggleTabs=function(){this.bExpandTabs=!this.bExpandTabs;var e=document.getElementById(this.name+"_expand_link");e.title=this.bExpandTabs?phpVars.messCollapseTabs:phpVars.messExpandTabs;e.className=this.bExpandTabs?e.className.replace(/\s*down/gi," up"):e.className.replace(/\s*up/gi," down");for(var t in this.aTabs){var s=this.aTabs[t]["DIV"];this.ShowTab(s,false);this.ShowDisabledTab(s,this.bExpandTabs||this.aTabsDisabled[s]);var i=document.getElementById(s);i.style.display=this.bExpandTabs&&!this.aTabsDisabled[s]?"block":"none";if(t>0){var n=jsUtils.FindChildObject(i.firstChild,"table","edit-tab-title");if(this.bExpandTabs){try{n.rows[0].style.display="table-row"}catch(e){n.rows[0].style.display="block"}}else n.rows[0].style.display="none"}}if(!this.bExpandTabs){this.ShowTab(this.aTabs[0]["DIV"],true);var i=document.getElementById(this.aTabs[0]["DIV"]);i.style.display="block"}jsUserOptions.SaveOption("edit",this.unique_name,"expand",this.bExpandTabs?"on":"off");jsUtils.onCustomEvent("OnToggleTabs")};this.ShowWarnings=function(e,t){var s=document.forms[e];if(!s)return;for(var i in t){var n=s.elements[t[i]["name"]];if(!n)continue;var a=n.type?n.type.toLowerCase():"";var l=false;if(n.length>1&&a!="select-one"&&a!="select-multiple"){n=n[0];l=true}if(a=="textarea"||a=="select-multiple")l=true;var o=n.parentNode;var r;if(l){r=o.insertBefore(new Image,n);o.insertBefore(document.createElement("BR"),n)}else{r=o.insertBefore(new Image,n.nextSibling);r.hspace=2;r.vspace=2;r.style.verticalAlign="bottom"}r.src="/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/images/icon_warn.gif";r.title=t[i]["title"]}};this.ShowSettings=function(e){if(document.getElementById("settings_float_div"))return;CHttpRequest.Action=function(e){CloseWaitWindow();if(e=="")return;var t=document.body.appendChild(document.createElement("DIV"));t.id="settings_float_div";t.className="settings-float-form";t.style.position="absolute";t.innerHTML=e;var s=parseInt(document.body.scrollLeft+document.body.clientWidth/2-t.offsetWidth/2);var i=parseInt(document.body.scrollTop+document.body.clientHeight/2-t.offsetHeight/2);jsFloatDiv.Show(t,s,i);jsUtils.addEvent(document,"keypress",_this.SettingsOnKeyPress)};ShowWaitWindow();CHttpRequest.Send(e)};this.CloseSettings=function(){jsUtils.removeEvent(document,"keypress",_this.SettingsOnKeyPress);var e=document.getElementById("settings_float_div");jsFloatDiv.Close(e);e.parentNode.removeChild(e)};this.SettingsOnKeyPress=function(e){if(!e)e=window.event;if(!e)return;if(e.keyCode==27)_this.CloseSettings()};this.SaveSettings=function(){ShowWaitWindow();var e="",t="";var s;var i=document.getElementById("selected_tabs");if(i){var n=i.length;for(var a=0;a<n;a++){t=i[a].value+"--#--"+i[a].text;s=document.getElementById("selected_fields["+i[a].value+"]");if(s){var l=s.length;for(var o=0;o<l;o++){t+="--,--"+s[o].value+"--#--"+jsUtils.trim(s[o].text)}}e+=t+"--;--"}}var r=document.form_settings.set_default&&document.form_settings.set_default.checked;var d=new JCHttpRequest;d.Action=function(){BX.reload()};var c="";c+="&p[0][c]=form";c+="&p[0][n]="+encodeURIComponent(this.name);if(r)c+="&p[0][d]=Y";c+="&p[0][v][tabs]="+encodeURIComponent(e);var u="/bitrix/admin/user_options.php?lang="+phpVars.LANGUAGE_ID+"&sessid="+phpVars.bitrix_sessid;u+="&action=delete&c=form&n="+this.name+"_disabled";d.Post(u,c)};this.DeleteSettings=function(e){ShowWaitWindow();jsUserOptions.DeleteOption("form",this.name,e,function(){BX.reload()})};this.DisableSettings=function(){var e=new JCHttpRequest;e.Action=function(){BX.reload()};var t="";t+="&p[0][c]=form";t+="&p[0][n]="+encodeURIComponent(this.name+"_disabled");t+="&p[0][v][disabled]=Y";e.Send("/bitrix/admin/user_options.php?lang="+phpVars.LANGUAGE_ID+t+"&sessid="+phpVars.bitrix_sessid)};this.EnableSettings=function(){var e=new JCHttpRequest;e.Action=function(){BX.reload()};var t="";t+="&c=form";t+="&n="+encodeURIComponent(this.name)+"_disabled";t+="&action=delete";e.Send("/bitrix/admin/user_options.php?lang="+phpVars.LANGUAGE_ID+t+"&sessid="+phpVars.bitrix_sessid)}}function ViewTabControl(aTabs){var _this=this;this.aTabs=aTabs;this.SelectTab=function(tab_id){var div=document.getElementById(tab_id);if(div.style.display!="none")return;for(var i in this.aTabs){var tab_div=document.getElementById(this.aTabs[i]["DIV"]);if(tab_div.style.display!="none"){var tab=document.getElementById("view_tab_"+this.aTabs[i]["DIV"]);tab.innerHTML=this.aTabs[i]["HTML"];tab.className="view-tab";this.ToggleDelimiter(tab,true);tab_div.style.display="none";break}}var active_tab=document.getElementById("view_tab_"+tab_id);active_tab.className="view-tab view-tab-active";this.ToggleDelimiter(active_tab,false);div.style.display="block";this.RebuildTabs();for(var i in this.aTabs){if(this.aTabs[i]["DIV"]==tab_id){this.ReplaceAnchor(this.aTabs[i]);if(this.aTabs[i]["ONSELECT"])eval(this.aTabs[i]["ONSELECT"]);break}}};this.ToggleDelimiter=function(e,t){var s;if((s=jsUtils.FindNextSibling(e,"div"))&&s.className.indexOf("view-tab-delimiter")!=-1)s.className="view-tab-delimiter"+(t?"":" view-tab-hide-delimiter");if((s=jsUtils.FindPreviousSibling(e,"div"))&&s.className.indexOf("view-tab-delimiter")!=-1)s.className="view-tab-delimiter"+(t?"":" view-tab-hide-delimiter")};this.DisableTab=function(e){};this.EnableTab=function(e){};this.ReplaceAnchor=function(e){var t=document.getElementById("view_tab_"+e["DIV"]);e["HTML"]=t.innerHTML;var s=jsUtils.FindChildObject(t,"a");t.innerHTML=s.innerHTML};this.RebuildTabs=function(){var e=jsUtils.FindParentObject(document.getElementById("view_tab_"+_this.aTabs[0]["DIV"]),"div");var t=[0];var s=-1;var i=-1;var n;var a=e.childNodes.length;for(var l=0;l<a;l++){var o=e.childNodes[l];if(!o.id)continue;if(i>-1&&o.offsetTop>i)t[t.length]=l;i=o.offsetTop;if(s==-1&&o.className.indexOf("view-tab-active")!=-1)s=t.length-1;n=o}if(s<t.length&&s>-1){var r=new Array;var o=e.childNodes[t[s]];for(var l=t[s];l<t[s+1];l++){r[r.length]=o;o=o.nextSibling}if(r.length>0){for(var l in r)e.removeChild(r[l]);while(n.nextSibling){n=n.nextSibling;if(n.tagName&&n.tagName.toUpperCase()=="BR"&&n.className&&n.className=="tab-break")break}var d=document.createElement("BR");d.style.clear="both";e.insertBefore(d,n);for(var l in r){if(r[l].tagName&&r[l].tagName.toUpperCase()=="BR")continue;e.insertBefore(r[l],n)}}}};this.Init=function(){if(this.aTabs.length==0)return;for(var e in this.aTabs){var t=document.getElementById(this.aTabs[e]["DIV"]);if(t.style.display!="none"){this.ReplaceAnchor(this.aTabs[e]);this.ToggleDelimiter(document.getElementById("view_tab_"+this.aTabs[e]["DIV"]),false);break}}setTimeout(this.RebuildTabs,10);window.onresize=this.RebuildTabs};this.Init()}var jsAdminChain={_chain:"",AddItems:function(e){var t=document.getElementById("main_navchain");if(!t)return;if(this._chain=="")this._chain=t.innerHTML;else t.innerHTML=this._chain;var s=document.getElementById(e);if(!s)return;t.innerHTML+='<span class="adm-navchain-delimiter"></span>';t.innerHTML+=s.innerHTML}};function JCHttpRequest(){this.Action=null;this._OnDataReady=function(e){if(this.Action)this.Action(e)};this._CreateHttpObject=function(){var e=null;if(window.XMLHttpRequest){try{e=new XMLHttpRequest}catch(e){}}else if(window.ActiveXObject){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}if(!e)try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}}return e};this._SetHandler=function(e){var t=this;e.onreadystatechange=function(){if(e.readyState==4){{var s=e.responseText;var i=[];var n,a;while((n=s.indexOf("<script>"))!=-1){var a=s.indexOf("<\/script>",n);if(a==-1)break;i[i.length]=s.substr(n+8,a-n-8);s=s.substr(0,n)+s.substr(a+9)}t._OnDataReady(s);for(var l=0,o=i.length;l<o;l++)if(i[l]!="")jsUtils.EvalGlobal(i[l])}}}};this.Send=function(e){var t=this._CreateHttpObject();if(t){t.open("GET",e,true);this._SetHandler(t);return t.send("")}};this.Post=function(e,t){var s=this._CreateHttpObject();if(s){s.open("POST",e,true);this._SetHandler(s);s.setRequestHeader("Content-Type","application/x-www-form-urlencoded");return s.send(t)}}}var CHttpRequest=new JCHttpRequest;function JCUserOptions(){var e=this;this.options=null;this.bSend=false;this.request=new JCHttpRequest;this.GetParams=function(){if(BX&&BX.userOptions){e.GetParams=BX.userOptions.__get;return e.GetParams.apply(BX.userOptions,arguments)}var t="";var s=-1;var i="";for(var n in e.options){var a=e.options[n];if(i!=a[0]+"."+a[1]){s++;t+="&p["+s+"][c]="+encodeURIComponent(a[0]);t+="&p["+s+"][n]="+encodeURIComponent(a[1]);if(a[4]==true)t+="&p["+s+"][d]=Y";i=a[0]+"."+a[1]}t+="&p["+s+"][v]["+encodeURIComponent(a[2])+"]="+encodeURIComponent(a[3])}return t.substr(1)};this.SaveOption=function(t,s,i,n,a){if(BX&&BX.userOptions){e.SaveOption=BX.userOptions.save;return e.SaveOption.apply(BX.userOptions,arguments)}if(!this.options)this.options=new Object;if(a!=true)a=false;this.options[t+"."+s+"."+i]=[t,s,i,n,a];var l=this.GetParams();if(l!="")document.cookie=phpVars.cookiePrefix+"_LAST_SETTINGS="+l+"&sessid="+phpVars.bitrix_sessid+"; expires=Thu, 31 Dec "+((new Date).getFullYear()+1)+" 23:59:59 GMT; path=/;";if(!this.bSend){this.bSend=true;setTimeout(function(){e.SendData(null)},5e3)}};this.SendData=function(t){if(BX&&BX.userOptions){e.SendData=BX.userOptions.send;return e.SendData.apply(BX.userOptions,arguments)}var s=e.GetParams();e.options=null;e.bSend=false;if(s!=""){document.cookie=phpVars.cookiePrefix+"_LAST_SETTINGS=; path=/;";e.request.Action=t;e.request.Send("/bitrix/admin/user_options.php?"+s+"&sessid="+phpVars.bitrix_sessid)}};this.DeleteOption=function(t,s,i,n){if(BX&&BX.userOptions){e.DeleteOption=BX.userOptions.del;return e.DeleteOption.apply(BX.userOptions,arguments)}e.request.Action=n;e.request.Send("/bitrix/admin/user_options.php?action=delete&c="+t+"&n="+s+(i==true?"&common=Y":"")+"&sessid="+phpVars.bitrix_sessid)}}var jsUserOptions=new JCUserOptions;function JCPanel(){var e=this;this.FixPanel=function(){var e=document.getElementById("admin_panel_fix_link");var t=document.getElementById("bx_top_panel_container");var s=document.getElementById("bx_top_panel_back");var i=t.style.position=="fixed"||t.style.position=="absolute";var n=jsUtils.IsIE();if(n){try{t.style.removeExpression("top")}catch(e){n=false}}if(i){e.title=phpVars.messPanelFixOn;e.className="fix-link fix-on";t.style.position="";s.style.display="none";if(n){t.style.removeExpression("top");t.style.removeExpression("left");t.style.removeExpression("width");t.style.width="100%";var a=document.getElementById("admin_panel_frame");if(a)a.style.visibility="hidden"}}else{this.ShowOn();if(n){var a=document.getElementById("admin_panel_frame");if(a)a.style.visibility="visible";else this.CreateFrame(t)}}jsUserOptions.SaveOption("admin_panel","settings","fix",i?"off":"on")};this.ShowOn=function(){var e=document.getElementById("admin_panel_fix_link");var t=document.getElementById("bx_top_panel_container");var s=document.getElementById("bx_top_panel_back");var i=jsUtils.IsIE();if(i){try{t.style.setExpression("top","0")}catch(e){i=false}}e.title=phpVars.messPanelFixOff;e.className="fix-link fix-off";t.style.position=i?"absolute":"fixed";t.style.left="0px";t.style.top="0px";t.style.zIndex="1000";if(i){if(document.body.currentStyle.backgroundImage=="none"){document.body.style.backgroundImage="url(/bitrix/images/1.gif)";document.body.style.backgroundAttachment="fixed";document.body.style.backgroundRepeat="no-repeat"}t.style.setExpression("top","eval((document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop)");t.style.setExpression("left","eval((document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft)");t.style.setExpression("width","eval((document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth)")}s.style.height=t.offsetHeight+"px";s.style.display="block"};this.FixOn=function(){this.ShowOn();jsUtils.addEvent(window,"load",this.AdjustBackDiv)};this.AdjustBackDiv=function(){var t=document.getElementById("bx_top_panel_container");var s=document.getElementById("bx_top_panel_back");var i=jsUtils.IsIE();if(i){try{s.style.setExpression("height","0")}catch(e){i=false}}s.style.height=t.offsetHeight+"px";if(i)e.CreateFrame(t)};this.CreateFrame=function(e){var t=document.createElement("IFRAME");t.src="javascript:void(0)";t.id="admin_panel_frame";t.style.position="absolute";t.style.overflow="hidden";t.style.zIndex=parseInt(e.currentStyle.zIndex)-1;t.style.height=e.offsetHeight+"px";document.body.appendChild(t);t.style.setExpression("top","eval(document.body.scrollTop)");t.style.setExpression("left","eval(document.body.scrollLeft)");t.style.setExpression("width","eval(document.body.clientWidth)");return t};this.IsFixed=function(){var e=document.getElementById("bx_top_panel_container");return e&&(e.style.position=="fixed"||e.style.position=="absolute")};this.DisplayPanel=function(e){var t=document.getElementById("bx_top_panel_splitter");if(t.style.display=="none"){t.style.display="block";e.className="splitterknob";e.title=phpVars.messPanelCollapse;jsUserOptions.SaveOption("admin_panel","settings","collapsed","off")}else{t.style.display="none";e.className="splitterknob splitterknobdown";e.title=phpVars.messPanelExpand;jsUserOptions.SaveOption("admin_panel","settings","collapsed","on")}var s=document.getElementById("bx_top_panel_container");var i=document.getElementById("bx_top_panel_back");i.style.height=s.offsetHeight+"px";var n=document.getElementById("admin_panel_frame");if(n)n.style.height=s.offsetHeight+"px"}}var jsPanel=new JCPanel;function JCDebugWindow(){var e=this;this.div_id="BX_DEBUG_WINDOW";this.div_current=null;this.div_detail_current=null;this.Show=function(e){var t=document.getElementById(this.div_id);if(t){t.style.display="block";var s=document.getElementById(e);if(s){if(this.div_current)this.div_current.style.display="none";s.style.display="block";this.div_current=s;this.ShowDetails(e+"_1")}var i=jsUtils.GetWindowSize();var n=parseInt(i["scrollLeft"]+i["innerWidth"]/2-t.offsetWidth/2);var a=parseInt(i["scrollTop"]+i["innerHeight"]/2-t.offsetHeight/2);jsFloatDiv.Show(t,n,a);jsUtils.addEvent(document,"keypress",this.OnKeyPress)}};this.Close=function(){jsUtils.removeEvent(document,"keypress",this.OnKeyPress);var e=document.getElementById(this.div_id);jsFloatDiv.Close(e);e.style.display="none"};this.OnKeyPress=function(t){if(!t)t=window.event;if(!t)return;if(t.keyCode==27)e.Close()};this.ShowDetails=function(e){var t=document.getElementById(e);if(t){if(this.div_detail_current)this.div_detail_current.style.display="none";t.style.display="block";this.div_detail_current=t}}}var jsDebugWindow=new JCDebugWindow;function ImgShw(e,t,s,i){var n="no";var a=0,l=0;if(t>screen.width-10||s>screen.height-28)n="yes";if(s<screen.height-28)a=Math.floor((screen.height-s)/2-14);if(t<screen.width-10)l=Math.floor((screen.width-t)/2-5);t=Math.min(t,screen.width-10);s=Math.min(s,screen.height-28);var o=window.open("","","scrollbars="+n+",resizable=yes,width="+t+",height="+s+",left="+l+",top="+a);o.document.write("<html><head>"+"<"+'script type="text/javascript">'+"function KeyPress()"+"{"+"\tif(window.event.keyCode == 27) "+"\t\twindow.close();"+"}"+"</"+"script>"+"<title></title></head>"+'<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onKeyPress="KeyPress()">'+'<img src="'+e+'" border="0" alt="'+i+'" />'+"</body></html>");o.document.close()}var WizardWindow={iframe:null,messLoading:phpVars.messLoading,currentDialog:null,currentFrame:null,isClosed:false,frameLoaded:false,Open:function(e,t){this.currentDialog=new BX.CWizardDialog({width:"700",height:"400",resizable:false});this.isClosed=false;this.frameLoaded=false;BX.addCustomEvent(this.currentDialog,"onBeforeWindowClose",BX.proxy(this.onBeforeWindowClose,this));var s=Math.random();this.currentDialog.SetContent('<iframe class="content" style="background-color: transparent; height:400px;" allowtransparency="true" scrolling="no" id="wizard_iframe_'+s+'" width="100%" src="/bitrix/admin/wizard_install.php?lang='+phpVars.LANGUAGE_ID+"&wizardName="+e+"&bxsender=admin_wizard_dialog&sessid="+t+'" frameborder="0"></iframe>');this.currentDialog.Show();setTimeout(BX.proxy(function(){if(!this.frameLoaded){this.ShowWaitWindow()}},this),400);this.currentFrame=BX("wizard_iframe_"+s);BX.bind(this.currentFrame,"load",BX.proxy(this.OnFrameLoad,this))},OnFrameLoad:function(){this.frameLoaded=true;this.HideWaitWindow();var e=this.currentFrame.contentWindow;var t=null;if(this.currentFrame.contentDocument)t=this.currentFrame.contentDocument;else t=this.currentFrame.contentWindow.document;if(e.focus)e.focus();else t.body.focus()},Close:function(){if(this.currentDialog){this.isClosed=true;this.currentDialog.Close(true)}},ShowWaitWindow:function(){if(this.currentDialog&&BX.type.isDomNode(this.currentDialog.PARTS.CONTENT)){var e=document.createElement("DIV");e.id="__bx_wait_window";e.className="";e.style.position="absolute";e.style.left="40%";e.style.top="40%";e.style.zIndex="3000";e.style.padding="15px 10px 15px 35px";e.style.width="auto";e.style.fontSize="12px";e.style.borderRadius="4px";e.style.boxShadow="0 0 10px 1px #dfdfdf";e.style.border="1px solid #DCE7ED";e.style.lineHeight="9px";e.style.background="#fff url(/bitrix/panel/main/images/waiter-white.gif) 3px center no-repeat";e.innerHTML=this.messLoading;this.currentDialog.PARTS.CONTENT.appendChild(e)}},HideWaitWindow:function(){var e=BX("__bx_wait_window");if(e&&e.parentNode)e.parentNode.removeChild(e)},onBeforeWindowClose:function(e){if(this.isClosed===false){e.denyClose=!confirm(BX.message("ADMIN_WIZARD_EXIT_ALERT"))}}};function JCStartMenu(){var menuStart=null;var request=new JCHttpRequest;var _this=this;this.EvalMenu=function(result){if(jsUtils.trim(result).length==0)return;var menuItems;try{eval(result)}catch(e){}if(!menuItems)return false;var head=document.getElementsByTagName("HEAD");if(head&&head[0]){var style=document.createElement("STYLE");head[0].appendChild(style);if(jsUtils.IsIE())document.styleSheets[document.styleSheets.length-1].cssText=menuItems["styles"];else style.appendChild(document.createTextNode(menuItems["styles"]))}return menuItems};this.ShowStartMenu=function(e,t){var s={left:0,top:0,right:0,bottom:0};if(!menuStart||!menuStart.menuItems){request.Action=function(t){var i=_this.EvalMenu(t);if(i){menuStart.PopupHide();menuStart.ShowMenu(e,i["items"],jsPanel.IsFixed(),s)}};menuStart=new PopupMenu("panel_start_menu");menuStart.Create(1100);menuStart.ShowMenu(e,[{TEXT:phpVars.messMenuLoading,TITLE:phpVars.messMenuLoadingTitle,ICONCLASS:"loading",AUTOHIDE:false}],jsPanel.IsFixed(),s);request.Send("/bitrix/admin/get_start_menu.php?lang="+phpVars.LANGUAGE_ID+(t?"&back_url_pub="+encodeURIComponent(t):"")+"&sessid="+phpVars.bitrix_sessid)}else{menuStart.ShowMenu(e,null,jsPanel.IsFixed(),s)}};this.PreloadMenu=function(e){if(!menuStart){request.Action=function(e){var t=_this.EvalMenu(e);if(t){menuStart.SetItems(t["items"]);menuStart.BuildItems()}};menuStart=new PopupMenu("panel_start_menu");menuStart.Create(1100);request.Send("/bitrix/admin/get_start_menu.php?lang="+phpVars.LANGUAGE_ID+(e?"&back_url_pub="+encodeURIComponent(e):"")+"&sessid="+phpVars.bitrix_sessid)}};this.OpenDynMenu=function(menu,module_id,items_id,back_url){request.Action=function(result){if(jsUtils.trim(result).length==0)return;var menuItems;eval(result);if(menu&&menuItems){var bVisible=menu.IsVisible();menu.PopupHide();menu.SetItems(menuItems["items"]);menu.BuildItems();menu.parentMenu.ShowSubmenu(menu.parentItem,false,!bVisible)}};request.Send("/bitrix/admin/get_start_menu.php?mode=dynamic&lang="+phpVars.LANGUAGE_ID+"&admin_mnu_module_id="+encodeURIComponent(module_id)+"&admin_mnu_menu_id="+encodeURIComponent(items_id)+(back_url?"&back_url_pub="+encodeURIComponent(back_url):"")+"&sessid="+phpVars.bitrix_sessid)};this.OpenURL=function(e,arguments,t,s){var i=menuStart.GetItemInfo(e);if(i){request.Action=function(e){};request.Send("/bitrix/admin/get_start_menu.php?mode=save_recent&url="+encodeURIComponent(t)+"&text="+encodeURIComponent(i["TEXT"])+"&title="+encodeURIComponent(i["TITLE"])+"&icon="+i["ICON"]+"&sessid="+phpVars.bitrix_sessid)}if(s)t+=(t.indexOf("?")>=0?"&":"?")+"back_url_pub="+encodeURIComponent(s);jsUtils.Redirect(arguments,t)}}var jsStartMenu=new JCStartMenu;function OnAdd(e,t){var s="cedit";if(!!t&&typeof t==="object"){if(!!t.tabPrefix)s=t.tabPrefix}var i=document.form_settings;if(e=="tabs_add"){var n=document.getElementById("selected_tabs");if(n){var a=prompt(arFormEditMess.admin_lib_sett_tab_prompt,arFormEditMess.admin_lib_sett_tab_default_name);if(a&&a.length>0){var l=n.length;var o=0;var r=true;while(r){o++;r=false;for(var d=0;d<l;d++)if(n[d].value==s+o)r=true}jsSelectUtils.addNewOption("selected_tabs",s+o,a,false);var c=document.getElementById("selected_fields");var u=document.createElement("SPAN");c.appendChild(u);u.innerHTML='<select style="display:none" class="select" name="selected_fields['+s+o+']" id="selected_fields['+s+o+']" size="12" multiple onchange="Sync();"></select>';jsSelectUtils.selectOption("selected_tabs",s+o)}}}if(e=="tabs_copy"){var m=document.getElementById("available_tabs");var f=document.getElementById("selected_tabs");if(m&&f){var l=m.length;var h=f.length;var o=0;for(var d=0;d<l;d++)if(m[d].selected){var r=false;for(var p=0;p<h;p++)if(f[p].value==m[d].value)r=true;if(!r){var c=document.getElementById("selected_fields");var u=document.createElement("SPAN");var v="selected_fields["+m[d].value+"]";c.appendChild(u);u.innerHTML='<select style="display:none" class="select" name="'+v+'" id="'+v+'" size="12" multiple onchange="Sync();"></select>';jsSelectUtils.addNewOption("selected_tabs",m[d].value,m[d].text,false);jsSelectUtils.selectAllOptions("available_fields");jsSelectUtils.addSelectedOptions(document.getElementById("available_fields"),v);jsSelectUtils.selectOption("selected_tabs",m[d].value)}}}}if(e=="fields_add"){var n=document.getElementById("selected_tabs");var b="";if(n){for(var d=0;d<n.length;d++)if(n[d].selected)b=n[d].value}n=GetFieldsActiveSelect();if(n){var a=prompt(arFormEditMess.admin_lib_sett_sec_prompt,arFormEditMess.admin_lib_sett_sec_default_name);if(a&&a.length>0){var l=n.length;var o=0;var r=true;while(r){o++;r=false;for(var d=0;d<l;d++)if(n[d].value==b+"_csection"+o)r=true}jsSelectUtils.addNewOption(n.id,b+"_csection"+o,"--"+a,false);jsSelectUtils.selectOption(n.id,b+"_csection"+o)}}}if(e=="fields_copy"){var m=document.getElementById("available_fields");var f=GetFieldsActiveSelect();if(m&&f&&!f.disabled){var d,g=f.length-1;for(d=0;d<f.length;d++){if(f[d].selected)g=d}var _=new Array;for(d=f.length-1;d>g;d--){var y=new Option(f[d].text,f[d].value,false,false);y.innerHTML=f[d].innerHTML;_[_.length]=y;f.remove(d)}for(d=0;d<f.length;d++)if(f[d].selected)f[d].selected=false;var S=0,E="";for(d=0;d<m.length;d++){if(m[d].selected){jsSelectUtils.addNewOption(f.id,m[d].value,m[d].text,false);f[f.length-1].selected=true;S++;if(d<m.length-1)E=m[d+1].value;else E=""}}var l=f.length;for(d=_.length-1;d>=0;d--){f[l]=_[d];l++}if(S==1&&E)jsSelectUtils.selectOption(m.id,E)}}Sync()}function OnDelete(e){if(e=="tabs_delete"){var t=document.getElementById("selected_tabs");for(var s=0;s<t.length;s++){if(t[s].selected){var i=document.getElementById("selected_fields["+t[s].value+"]");var n=i.parentNode;n.removeChild(i)}}jsSelectUtils.deleteSelectedOptions(t.id);jsSelectUtils.selectOption(t.id,"")}if(e=="fields_delete"){var i=GetFieldsActiveSelect();if(i){jsSelectUtils.deleteSelectedOptions(i.id);jsSelectUtils.selectOption(i.id,"")}}Sync()}function Sync(){var e,t,s,i;var n=document.getElementById("available_tabs");var a=document.getElementById("available_fields");var l=document.getElementById("selected_tabs");var o="";for(e=0;e<n.length;e++)if(n[e].selected)o=n[e].value;var r=new Object;for(e=0;e<a.length;e++){if(a[e].selected)r[a[e].value]=a[e].value}jsSelectUtils.selectAllOptions(a.id);jsSelectUtils.deleteSelectedOptions(a.id);if(o){var d=new Object;for(e=0;e<l.length;e++){var c=document.getElementById("selected_fields["+l[e].value+"]");for(t=0;t<c.length;t++)d[c[t].value]=c[t].value}s=0;for(available_field in arSystemTabsFields[o]){if(!d[available_field]){var u=new Option(arSystemFields[available_field],available_field,false,false);a.options[s]=u;a.options[s].innerHTML=arSystemFields[available_field];s++}}for(e=0;e<a.length;e++)if(r[a[e].value])a[e].selected=true}i=false;for(e=0;e<l.length;e++){var c=document.getElementById("selected_fields["+l[e].value+"]");if(l[e].selected){c.style.display="block";i=true}else{c.style.display="none"}}if(i)document.getElementById("selected_fields[undef]").style.display="none";else document.getElementById("selected_fields[undef]").style.display="block";var m=0;for(e=0;e<l.length;e++)if(l[e].selected)m++;var f=0;for(e=0;e<n.length;e++)if(n[e].selected)f++;document.getElementById("tabs_delete").disabled=m<=0;if(f<=0){document.getElementById("tabs_copy").disabled=true}else{i=false;for(e=0;e<l.length;e++)if(l[e].value==o)i=true;document.getElementById("tabs_copy").disabled=i}document.getElementById("tabs_up").disabled=m<=0;document.getElementById("tabs_down").disabled=m<=0;document.getElementById("tabs_rename").disabled=m!=1;document.getElementById("tabs_add").disabled=false;var h=0;for(e=0;e<l.length;e++){if(l[e].selected){var c=document.getElementById("selected_fields["+l[e].value+"]");for(t=0;t<c.length;t++)if(c[t].selected)h++}}var p=0;for(e=0;e<a.length;e++)if(a[e].selected)p++;document.getElementById("fields_delete").disabled=h<=0;document.getElementById("fields_copy").disabled=p<=0||m<=0;document.getElementById("fields_up").disabled=h<=0;document.getElementById("fields_down").disabled=h<=0;document.getElementById("fields_rename").disabled=h!=1;document.getElementById("fields_add").disabled=m!=1;var v=new Object;for(var b in arSystemFields)v[b]=arSystemFields[b];for(e=0;e<l.length;e++){c=document.getElementById("selected_fields["+l[e].value+"]");for(t=0;t<c.length;t++)delete v[c[t].value]}var g=[];for(var b in v){if(v[b].substring(0,1)==="*"){g.push(v[b].substring(1))}}var _=document.getElementById("save_settings"),y=document.getElementById("save_settings_error"),S=document.getElementById("absent_required_fields");if(g.length>0){S.innerHTML=g.join("<br>");y.style.display="block";_.disabled=true}else{S.innerHTML="";y.style.display="none";_.disabled=false}}function SyncAvailableFields(){var e=document.getElementById("available_tabs");if(e){var t=e.length;for(var s=0;s<t;s++){oFieldsSelect=document.getElementById("available_fields");if(oFieldsSelect){jsSelectUtils.selectAllOptions(oFieldsSelect.id);jsSelectUtils.deleteSelectedOptions(oFieldsSelect.id);if(e[s].selected){var i=0;for(var n in arSystemTabsFields[e[s].value]){var a=new Option(arSystemFields[n],n,false,false);oFieldsSelect.options[i]=a;oFieldsSelect.options[i].innerHTML=arSystemFields[n];i++}}}}}}function GetFieldsActiveSelect(){var e;var t=document.getElementById("selected_tabs");if(t){var s=t.length;for(var i=0;i<s;i++){e=document.getElementById("selected_fields["+t[i].value+"]");if(e&&e.style.display=="block")return e}}return false}function OnRename(e){var t=document.form_settings;if(e=="tabs_rename"){var s=document.getElementById("selected_tabs");if(s){var i=s.length;var n=0;var a="";for(var l=0;l<i;l++){if(s[l].selected){n++;if(!a)a=s[l].text}}if(n==1){var o=prompt(arFormEditMess.admin_lib_sett_tab_rename,a);if(o&&o.length>0){for(var l=0;l<i;l++)if(s[l].selected){s[l].text=o;break}}}}}if(e=="fields_rename"){var s=GetFieldsActiveSelect();if(s){var i=s.length;var n=0;var a="";for(var l=0;l<i;l++){if(s[l].selected){n++;if(!a)a=s[l].innerHTML}}if(n==1){var r="";if(a.substring(0,2)=="--"){a=a.substring(2);r="--"}else{if(a.substring(0,1)=="*"){a=a.substring(1);r="*"}else{if(a.substring(0,12)=="&nbsp;&nbsp;"){a=a.substring(12);r="&nbsp;&nbsp;"}else{while(a.substring(0,2)=="\xa0\xa0"||a.substring(0,2)=="\xc2\xa0"){a=a.substring(2);r="&nbsp;&nbsp;"}}}}var o=prompt(arFormEditMess.admin_lib_sett_sec_rename,a);if(o&&o.length>0){for(var l=0;l<i;l++)if(s[l].selected){if(r=="&nbsp;&nbsp;"){s[l].text=o;s[l].innerHTML="&nbsp;&nbsp;"+s[l].innerHTML}else{s[l].text=r+o}break}}}}}}function FieldsUpAndDown(e){var t=GetFieldsActiveSelect();if(t){if(e=="up")jsSelectUtils.moveOptionsUp(t);else jsSelectUtils.moveOptionsDown(t)}}function exportSettingsToPhp(e,t){if(e.ctrlKey||BX.browser.IsMac()&&e.altKey){var s=[];var i="";var n="CAdminFormSettings::setTabsArray('"+t+"', array(<br>";var a=document.getElementById("selected_tabs");if(a){var l=a.length;for(var o=0;o<l;o++){i="_"+a[o].value+"_TAB_TITLE";s[s.length]={id:i,val:a[o].text};n+="\t'"+a[o].value+"' => array(<br>";n+="\t\t'TAB' => GetMessage('"+i+"'),<br>";n+="\t\t'FIELDS' => array(<br>";oFieldsSelect=document.getElementById("selected_fields["+a[o].value+"]");if(oFieldsSelect){var r=oFieldsSelect.length;for(var d=0;d<r;d++){i="_"+oFieldsSelect[d].value;s[s.length]={id:i,val:jsUtils.trim(oFieldsSelect[d].text)};n+="\t\t\t'"+oFieldsSelect[d].value+"' => GetMessage('"+i+"'),<br>"}}n+="\t\t),<br>";n+="\t),<br>"}}n+="), true);<br>";for(var o=0;o<s.length;o++){n+='$MESS["'+s[o].id+'"]="'+s[o].val+'";<br>'}var c=new BX.CDialog({content:"<pre>"+n+"</pre>",buttons:[BX.CDialog.btnOK,BX.CDialog.btnCancel],width:640,height:480});c.Show()}}
//# sourceMappingURL=admin_tools.map.js